package org.openkanban.client.ui.board;

import java.util.ArrayList;
import java.util.List;

/**
 * Implemented composite pattern here. All elements of the composite must
 * implement switchBoard Method, so that there is a consistent state of which
 * board is shown.
 * 
 */
public class BoardComponent implements BoardComposite {

    public static List<BoardComposite> boardCompositeList = new ArrayList<BoardComposite>();

    @Override
    public void switchBoard(Long boardId) {
	for (BoardComposite boardComposite : boardCompositeList) {
	    boardComposite.switchBoard(boardId);
	}
    }

    public void addComposite(BoardComposite newComposite) {
	boardCompositeList.add(newComposite);
    }
}
